<?php
$this->Html->script('controllers/Teams/magic.js?1', array('block' => 'scriptBottom'));
$this->Html->script('controllers/Teams/lines.js?1', array('block' => 'scriptBottom'));
$this->Html->script('controllers/Teams/teams.js?1', array('block' => 'scriptBottom'));
$this->Html->script('controllers/Teams/users.js?1', array('block' => 'scriptBottom'));
$this->Html->css('controllers/Teams/teams.css?1', array('block' => 'stylesTop'));
$this->Html->css('controllers/Teams/lines.css?1', array('block' => 'stylesTop'));
$this->Html->css('controllers/Teams/users.css?1', array('block' => 'stylesTop'));
$this->Html->css('controllers/Teams/magic.css?1', array('block' => 'stylesTop'));
$appBosch->urlCreateGroup = $this->Html->url(array('action'=>'create'));
$appBosch->urlReadGroups = $this->Html->url(array('action'=>'read'));
$appBosch->urlDestroyGroup = $this->Html->url(array('action'=>'destroy'));
$appBosch->urlMh = $this->Html->url(array('controller'=>'Abilities','action'=>'admin'));
$appBosch->urlTeam = $this->Html->url(array('action'=>'details'));
$appBosch->urlSaveNameTeam = $this->Html->url(array('action'=>'saveName'));
$appBosch->urlTeamById = $this->Html->url(array('action'=>'get'));
$appBosch->urlTeamLinesCreate = $this->Html->url(array('controller'=>'TeamLines', 'action'=>'create'));
$appBosch->urlTeamLinesRead = $this->Html->url(array('controller'=>'TeamLines', 'action'=>'read'));
$appBosch->urlTeamLinesRead = $this->Html->url(array('controller'=>'TeamLines', 'action'=>'read'));
$appBosch->urlTeamLinesDestroy = $this->Html->url(array('controller'=>'TeamLines', 'action'=>'destroy'));
$appBosch->urlFilterUsers = $this->Html->url(array('controller'=>'Users', 'action'=>'filter'));
$appBosch->urlTeamUsersCreate = $this->Html->url(array('controller'=>'TeamUsers', 'action'=>'create'));
$appBosch->urlTeamUsersRead = $this->Html->url(array('controller'=>'TeamUsers', 'action'=>'read'));
$appBosch->urlTeamUsersDestroy = $this->Html->url(array('controller'=>'TeamUsers', 'action'=>'destroy'));
$appBosch->urlTeamUsersMultiple = $this->Html->url(array('controller'=>'TeamUsers', 'action'=>'addUsers'));
$appBosch->urlGetTeamBySeed = $this->Html->url(array('controller'=>'Teams', 'action'=>'getBySeed', $appBosch->areaId));
$appBosch->urlGetUsersTeam = $this->Html->url(array('controller'=>'TeamUsers', 'action'=>'getUsersByTeam'));
/*
 * <hr class="divider" >
agregar el kendocombobox para seleccionar la linea
agregar un hr para tenerlo como separador*/
?>
<!--Template de los equipos-->
<script type='text/x-kendo-template' id='templateTeam'>
    <div class='team droptarget' data-type="#=type#" title='#=name#' data-team-id="#=id#" data-team-name="#=name#" data-team-shift="#=shift#" data-team-line="#=line#" style="border-color: #=colour_line#">
    <div>
    <i class="fa fa-circle" style="color: #=colour_line#" title="<?php echo ('Línea'); ?>: #=line#"></i>
    <div class="name">#=name#</div>
    #if(type === "1"){#
    <i class='fa fa-times destroy' title="<?php echo __('Eliminar equipo');?>"></i>
    #}#
    <i class='fa fa-wrench' data-team-name="#=name#" data-team-id="#=id#" title="<?php echo __('Configurar equipo');?>"></i>
    <i class="fa fa-group"></i>
    <i class="fa fa-refresh fa-spin hidden"></i>
    </div>
    </div>
</script>
<script type='text/x-kendo-template' id='templateToolTipTeam'>
    <div>
        <?php echo __('Equipo');?>: #=target.data('teamName')#
    <br/>
        <?php echo __('Línea');?>: #=target.data('teamLine')#
    <br/>
    </div>
</script>
<!--Template de las lineas disponibles-->
<script type='text/x-kendo-template' id='templateLine'>
    <div class='line draggable' title='#=text#' data-line-id="#=value#" data-line-name="#=text#" data-line-colour="#=colour#" style='background-color: #=colour#'>
    <div>
    #=text#
    </div>
    </div>
</script>
<!--Template de las lineas asignadas-->
<script type='text/x-kendo-template' id='templateTeamLine'>
    <div class='line' title='#=line_name#' data-id="#=id#" data-line-id="#=line_id#" data-line-name="#=line_name#" data-line-colour="#=line_colour#" style='background-color: #=line_colour#'>
    <i class='fa fa-times destroy' title="<?php echo __('Eliminar línea asignada');?>"></i>
    <div>
    #=line_name#
    </div>
    </div>
</script>
<script type='text/x-kendo-template' id='templateGroupDetail'>
    <div>
    <label for="line"><?php echo __('Línea');?></label>
    <input id="line" type='text' value='#=line#' readonly="readonly"/>
    </div>
    <div>
    <label for="shift"><?php echo __('Turno');?></label>
    <input id="shift" type='text' value='#=shift#' readonly="readonly"/>
    </div>
</script>
<!--Template para los usuarios-->
<script type="text/x-kendo-template" id="templateUser">
    <div class='user draggable' title='#=full_name#' data-user-id='#=id#' data-user-name="#=full_name#" data-user-nomina="#=nomina#" data-user-curp="#=curp#" data-user-admission-date="#=admission_date#">
    <table>
    <tr>
    <td rowspan="2">
    <i class="fa fa-user"></i>
    <div class="nomina">#=nomina#</div>
    </td>
    <td>
    <div class="fullName">#=full_name#</div>
    <div class="curp">#=curp#</div>
    <div class="admissionDate">#=admission_date#</div>
    </td>
    </tr>
    <tr>
    <td></td>
    </tr>
    </table>
    </div>
</script>
<script type="text/x-kendo-template" id="templateTeamUser">
    <div class='teamUser draggable' data-id="#=id#" data-user-id='#=user_id#' data-user-name="#=full_name#" data-user-nomina="#=nomina#" data-user-curp="#=curp#" data-user-admission-date="#=admission_date#">
    <table>
    <tr>
    <td class="icon">
    <i class="fa fa-user"></i>
    <div class="nomina">#=nomina#</div>
    </td>
    <td class="detail">
    <div class="fullName"><?php echo __('Nombre');?>: #=full_name#</div>
    <div class="curp"><?php echo __('CURP');?>: #=curp#</div>
    <div class="admissionDate"><?php echo __('Ingreso');?>: #=admission_date#</div>
    </td>
    <td class="destroy">
    <i class='fa fa-times destroy' title="<?php echo __('Eliminar usuario asignado');?>"></i>
    </td>
    </tr>
    </table>
    </div>
</script>
<!--Equipos-->
<div>
    <div class="pull-left">
        <button class='btn btn-primary' id='addTeam' type='button'>
            <i class='fa fa-plus'></i>
            <?php echo __('Agregar equipo');?>
        </button>
    </div>
    <div class="pull-right">
        <div class="form-inline" role="form" id="formGetTeamByUser">
            <div class="form-group">
                <div class="input-group">
                    <label class="sr-only" for="getTeamByUser"><?php echo __('Buscar asociado');?></label>
                    <input type="text" class="form-control" id="getTeamByUser" placeholder="Buscar por: usuario | equipo | línea | nomina | curp">
                    &nbsp;
                    <button class='btn btn-primary' type="button">
                        <?php echo __('Buscar');?>
                    </button>
                    <i class="fa fa-refresh fa-spin hidden"></i>
                </div>
            </div>
        </div>
    </div>
</div>
<br/>
<br/>
<!--Equipos filtrados-->
<div class='container-teams'>
    <!--Aqui se insertan todos los equipos del area-->
</div>
<div class='container-teams-filter hidden'>
    <div class='results hidden'>
        <div class='teams'>
            <!--Aqui se insertan los equipos filtrados-->
        </div>
    </div>
    <div class='noResults hidden alert alert-info'>
        <?php echo __('No se encontraron equipos que coincidan con el criterio de busqueda');?>
    </div>
    <div>
        <button class='btn btn-primary'>
        <?php echo __('Ver todos los equipos');?>
        </button>
    </div>
</div>
<!--Fin equipos filtrados-->
<!--Ventana de la edicion del grupo-->
<div class="hide">
    <div id='wndTeam'>
        <div class="col-lg-12">
            <label for="#nameTeam"><?php echo ('Nombre del equipo');?></label>
            <input id="nameTeam" type="text" value=""/>
        </div>
        <hr class="divider"/>
        <div class="col-lg-12">
            combo para lineas virtuales
        </div>
        <hr class="divider"/>
        <div class="lineAndShift"></div>
        <div class="container-users">
            <div class="col-lg-6 pull-right">
                <h3><?php echo __('Buscar asociados');?></h3>
                <input id="customers" style="width: 100%;" placeholder="<?php echo __('Nombre | nomina | curp | fecha de ingreso')?>"/>
            </div>
            <div class="col-lg-5 pull-left">
                <h3><?php echo __('Asociados asignados');?></h3>
                <div class="form-inline" role="form">
                    <div class="form-group">
                        <label for="addByNomina" class="sr-only"><?php echo __('Número de nomina');?></label>
                        <input type="text" class="form-control" id="addByNomina" placeholder="<?php echo __('Número de nomina');?>">
                    </div>
                    <button type="button" class="btn btn-default pull-right" id="addUsers">
                        <i class="fa fa-plus"></i>
                        <?php echo __('Agregar');?>
                    </button>
                </div>
                <br/>
                <div class="my"></div>
            </div>
        </div>
        <hr class="divider"/>
        <div class="container-lines">
            <div class="col-lg-5 pull-left">
                <h3><?php echo __('Líneas asignadas');?></h3>
                <div class="my" id="droptargetLine">
                </div>
            </div>
            <div class="col-lg-6 pull-right">
                <h3><?php echo __('Líneas disponibles');?></h3>
                <div class="all">
                </div>
            </div>
        </div>
    </div>
</div>
<?php $this->start('jsVars'); ?>
<script type="text/javascript">
    var appBosch = <?php echo json_encode($appBosch); ?>;
</script>
<?php
$this->end();
